#pragma once

#include "mysql_result.h"

#include <cstdint>
#include <mysql/mysql.h>
#include <string>

class MySQLHandle
{
public:
    MySQLHandle(
        const std::string &host, uint16_t port, const std::string &username, const std::string &password, const std::string &database);
    ~MySQLHandle();

public:
    void        Create(const std::string &sql);
    void        Drop(const std::string &sql);
    uint64_t    Insert(const std::string &sql);
    void        InsertList(const std::string &sql);
    uint64_t    Update(const std::string &sql);
    uint64_t    Remove(const std::string &sql);
    MySQLResult Select(const std::string &sql);

    MYSQL *nativeHandle()
    {
        return mysql_handle_;
    }

private:
    MYSQL *mysql_handle_;
};
